<TABLE class=design bgColor=#ffffff cellPadding=3 cellSpacing=0 width=100% border='1' BORDERCOLOR="#C0C0C0" STYLE="border-collapse: collapse">
<?php
	if(!isset($_POST)){
		extract($HTTP_POST_VARS);
		extract($HTTP_GET_VARS);
		extract($HTTP_COOKIE_VARS);
		extract($HTTP_ENV_VARS);
		extract($HTTP_SERVER_VARS);
	}else{
		extract($_POST);
		extract($_GET);
		extract($_COOKIE);
		extract($_ENV);
		extract($_SERVER);
	}
	if($what == 'process'){
?>
<tr>
	<td colspan=3>
<?
		$goToit = 1;
		if($goToit == 1){
			$query = mysql_query("SELECT count(*) FROM forum WHERE name = '{$strname}'");
			if(mysql_result($query, 0, 0) == 0){
				$strQuery  = "INSERT INTO forum (";
				$strQuery .= "name, description,uid) VALUES (";
				$strQuery .= "'{$strname}', '$strdescription','$strUid')";

				if(mysql_query($strQuery)){
?>
					<span class="title">Forum Added</span><br><br>
					You have sucsessfully added the new Forum to the system.

					<a href="<?=$PHP_SELF?>?a=<?=$a?>">Continue</a>
<?php
				}
			}else{
?>
				<span class="title">Error</span><br><br>
				The name you have choosen is already used. Please select another name.<br>
				Please use the link below to return.<br><br>
				<a href="javascript:history.go(-1);">Back</a>
<?php
			}
		}else{
?>
			<span class="title">Error</span><br><br>
			Sorry, but the descriptions you supplied did not match. Please use the link below to return.<br><br>
			<a href="javascript:history.go(-1);">Back</a>
<?php
		}
?>
	</td>
</tr>
<?
	}else{
?>
		<form action="<?=$PHP_SELF?>" method="post" name="form1">
		<input type="hidden" name="what" value="process">
		<input type="hidden" name="a" value="<?=$a?>">
		<input type="hidden" name="step" value="<?=$step?>">
		<tr>
			<td colspan="2">
				<div align="center"><strong><font color="#0066CC" size="3" face="Verdana, Arial, Helvetica, sans-serif">Add New Forum</font></strong></div>
			</td>
		</tr>
		<tr>
			<td>
				<div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">name&nbsp;&nbsp;</strong>
			</td>
			<td><input size=55 type="text" name="strname" value=""></td>
		</tr>
		<tr>
			<td>
				<div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Owner&nbsp;&nbsp;</strong>
			</td>
			<td>
				<select name="strUid">
					<option value="0">-- Choose a User --
<?
					userList($sel);
?>
				</select>
			</td>
		</tr>
		<tr>
			<td>
				<div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">description&nbsp;&nbsp;</strong>
			</td>
			<td><input size=55 type="description" name="strdescription" value=""></td>
		</tr>
		<tr>
			<td colspan="2"><hr width="100%" size="1" color="#66B0DC"></td>
		</tr>
		<tr>
			<td colspan="2">
				<div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;
					<input type="submit" alt="submit" width="66" height="20" hspace="5" vspace="5" border="0">
					<input type="reset" alt="submit" width="66" height="20" hspace="5" vspace="5" border="0">
				</font></div>
			</td>
		</tr>
		</form>
<?php
	}
?>
</table>
<?
	function userList($sel){
		$sql = "SELECT * FROM users";
		$result = mysql_query($sql) or die( mysql_error() );
		if ($result){
			while( $row = mysql_fetch_object($result) ){
				$sela = "";
				if($row->uid == $sel) $sela = "SELECTED";
?>
				<option value="<?=$row->uid?>" <?=$sela?>><?=$row->username?> - <?=$row->email?></option>
<?
			}
		}
	}
?>